<?php

class CustomerController extends ExtCRUDController
{

    protected function handleReadAction()
    {
        if (isset($_POST['id']))
        {
            $total = 1;
            $data = Customer::model()->find('CustomerId = :cid', array(':cid' => $_POST['id']));
        }
        else
        {
            $pi = $this->getPagingInfo();
            $total = Customer::model()->count();
            $data = Customer::model()->findAll(
                            '1=1 order by CustomerId limit :limit offset :offset',
                            array(':limit' => $pi['limit'], ':offset' => $pi['start'])
            );
        }
        return $this->ExportToJSONDataSource($data, $total);
    }

    protected function handleCreateAction($rows)
    {
//        $emp = new Employee();
//        $emp->attributes = $rows;
//        return array('success'=>$emp->save(),'errors'=>$emp->getErrors());
    }

    protected function handleDestroyAction($id)
    {
//        $record = Employee::model()->findByPk($id);
//        $record->delete();
//        return true;
    }

    protected function handleUpdateAction($rows)
    {
//        $record = Employee::model()->findByPk($rows['EmployeeId']);
//        $record->attributes = $rows;
//        return array('success'=>$record->save(),'errors'=>$record->getErrors());
    }

}

?>